package com.wnxy.sdd.front.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wnxy.sdd.front.entity.Subject;
import com.wnxy.sdd.front.mapper.SubjectMapper;
import com.wnxy.sdd.front.service.ISubjectService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 课程科目 服务实现类
 * </p>
 *
 * @author Jet
 * @since 2023-03-27
 */
@Service
public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> implements ISubjectService {
    @Override
    public List<Subject> querySecondSubject() {
        return this.list(Wrappers.<Subject>lambdaQuery()
                .ne(Subject::getParentId,0));
    }

    /**
     * 查询所有二级分类科目
     * @return
     */
    public List<Subject> querySubjectTwos() {
        QueryWrapper<Subject> wrapper = new QueryWrapper<>();
        wrapper.ne("parent_id", "0");
        return baseMapper.selectList(wrapper);
    }
}